package fourzerofour.yangqiang.day02;
import java.util.Scanner;
/**
 * 用户输入一个年份，一个月份，程序输入当年当月的天数
 * ① 能被4整除，但不能被100整除；
 * ② 即能被100整除，又能被400整除
 */
public class Question4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入年份:");
        int year = scanner.nextInt();
        System.out.println("请输入月份:");
        int mouth = scanner.nextInt();
        int day ;
        if((year%4==0&&year%100!=0)||year%400==0){
            day = 29;
        }else{
            day =28;
        }
        switch(mouth){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                 System.out.println("该月共有31天");
                 break;
            case 2:
                 System.out.println("该月共有"+day+"天");
                 break;
            default:
                 System.out.println("该月共有30天");
        }
    }
}
